package a02demo2;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class Test12 {
    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();
        Collections.addAll(list, 1, 1, 1, 1, 1, 1, 1);
        Collections.addAll(list, 0, 0, 0);
        Collections.shuffle(list);

        Random r = new Random();
        int index = r.nextInt(list.size());
        int num = list.get(index);
        System.out.println(num);

        ArrayList<String> list1=new ArrayList<>();
        ArrayList<String> list2=new ArrayList<>();
        Collections.addAll(list1,"a","b","c");
        Collections.addAll(list2,"d","e","f");

        if(num==1){
            int i1 = r.nextInt(list1.size());
            String s1 = list1.get(i1);
            System.out.println(s1);
        }
        else{
            int i2 = r.nextInt(list2.size());
            String s2 = list2.get(i2);
            System.out.println(s2);
        }
    }
}
